# Author:Haixin
# week07

# P67页   "Don't panic!" => list => "on tap"
phrase = "Don't panic!"
plist = list(phrase) # str 转换 list 使用的方法是 list(str) 字符串转换成一组值
print(phrase)
print(plist)

for i in range(4):
    # 循环四次 删除末位 使用方法pop（）
    plist.pop()
print(plist)
plist.pop(0)
print(plist)
plist.remove("'")
print(plist)
# extend ==> plist + ["a","p"]
plist.extend([plist.pop(),plist.pop()]) # 运算顺序，先算小括号再算大括号（1*（5+1））
# ['o','n','t']   a         p
print(plist)
plist.insert(2,plist.pop(3))
#               ' '
print(plist)
new_phrase = ''.join(plist) # ? ''.join() lisr转换 str
print("plist = ",plist) # list方法会打乱和改变list的内容
print(new_phrase)
